"use strict";
const electron = require("electron");
electron.contextBridge.exposeInMainWorld("ipcRenderer", {
  on(...args) {
    const [channel, listener] = args;
    return electron.ipcRenderer.on(channel, (event, ...args2) => listener(event, ...args2));
  },
  off(...args) {
    const [channel, ...omit] = args;
    return electron.ipcRenderer.off(channel, ...omit);
  },
  send(...args) {
    const [channel, ...omit] = args;
    return electron.ipcRenderer.send(channel, ...omit);
  },
  invoke(...args) {
    const [channel, ...omit] = args;
    return electron.ipcRenderer.invoke(channel, ...omit);
  },
  // You can expose other APTs you need here.
  // 设置本地存储
  onSetLocalStore: (key, value) => {
    electron.ipcRenderer.invoke("onSetLocalStore", key, value);
  },
  // 监听窗口变化
  winTitleOp: (action, data) => {
    electron.ipcRenderer.invoke("winTitleOp", action, data);
  },
  // 登录注册切换
  onLoginOrRegister: (isLogin) => {
    electron.ipcRenderer.invoke("onLoginOrRegister", isLogin);
  },
  // 登录成功
  onLoginSuccess: (config) => {
    electron.ipcRenderer.invoke("onLoginSuccess", config);
  },
  // 重新登录
  onReLogin: () => {
    console.log("重新登录");
    electron.ipcRenderer.invoke("onReLogin");
  },
  addToContact: (uid) => {
    console.log("uid===>", uid);
    electron.ipcRenderer.invoke("onAddToContact", uid);
    console.log("uid===>", uid);
  }
});
